package com.molin.IOtest.objectStreamTest;

import java.io.*;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        //将对象写入到文件，被称为序列化流
        User zhangsan=new User("zhangsan","zhangsan123");
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("D:\\IdeaProjects\\BasicCode\\mIdeaTest\\src\\com\\molin\\IOtest\\objectStreamTest\\pwd.txt"));
        oos.writeObject(zhangsan);
        oos.close();
    }
}
